public class test1 {
    public static void main(String[] args) {

                int sum = 0;
                for (int i = 1; i <= 5; i++) {
                    sum += fac(i);
                }
                System.out.println("sum = " + sum);
            }

            public static int fac(int n) {
                System.out.println("计算 n 的阶乘中n! = " + n);
                int result = 1;
                for (int i = 1; i <= n; i++) {
                    result *= i;
                }
                return result;

    }
}
